var app = angular.module('myApp');
app.controller('publicContro',['$scope','$http','$timeout','navServ',function($scope,$http,$timeout,navServ){
	//-------------改变导航点击时的颜色---------------------------
	var lis = document.querySelectorAll('.top_list>li>a');
	
	$scope.change = function(num){
		for(var i=0;i<lis.length;i++){
			lis[i].style.color = '#999';
			lis[i].className = '';
		}
		lis[num].style.color = 'orangered';
		lis[num].className = 'b';
	}

    //---------------热门数据解析------------------------
	$http.get("./json/guangchangremen.json").then(function (obj) {   
		$scope.data = obj.data.data;
//		console.log($scope.data);
    })
	
	//---------------最新数据解析----------------------
	$http.get("./json/guangchang.json").then(function (num) {   
		$scope.dat = num.data.data;
	})
	//---------当导航栏滚动到一定程度，固定在顶部--------------
	$timeout(function(){
		navServ.posStyle($('.top_list'));
	},30)
}])

   